/**
 * There are <a href="https://github.com/ketayao/keta-custom">keta-custom</a> code generation
 */
package fms.dao;

import java.util.List;

import fms.model.CptSend;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

public interface CptSendDAO extends JpaRepository<CptSend, Long>, JpaSpecificationExecutor<CptSend> {
    @Query("FROM CptSend d  where  flightId=?1 and  aircraftId=?2   and planDate>=to_date(?3, 'yyyy-MM-dd hh24:mi:ss') and sendType=2 ORDER BY  planDate  DESC")
    public List<CptSend> findCptSend(String flightId, String aircraftId, String flyPlanValidTime);

    @Query("FROM CptSend d  where  flightId=?1 and  aircraftId=?2    and sendType=1 ORDER BY  planDate  DESC ")
    public List<CptSend> findCptSendwid(String flightId, String aircraftId);

    @Query("FROM CptSend d  where appUpMsgId=?1 ")
    public List<CptSend> findCptSendbymsgId(String appUpMsgId);

    @Query("FROM CptSend d where flightId=?1 and aircraftId=?2 and planId=?3 and sendType=?4")
    public List<CptSend> findCptSend2(String flightId, String aircraftId, String planId,String sendType);
}